/*************************************************
Author: will
Date: 11/2/2012
Description:
Notes:
*************************************************/

#ifndef __cmdshop_h__
#define __cmdshop_h__

#include "cmduserinfo.h"
#include "../cmd/cmdselectdatafromdbsvr.h"
#include "../mainctrl.h"
#include "../cmd/dataprepare.h"
#include "MsgShop.pb.h"

class CCmdGetShopInfo : public CTAsyncCmd
{
public:
    virtual int Do(void* pData);
    virtual int LogicDo(int iRet);
    virtual int AnsClients(int iRet);

    int CheckUpdate (CPlayerDetailInfo &, CPlayerOnlineData & );

    CMainCtrl* pstMainCtrl;
    PBMsgHead  stMsgHead;
    CEnpNetHead stEnpHead;

    MsgReqShopInfo stReq;
    MsgAnsShopInfo stAns;

    unsigned int _uiGID;
};

class CCmdShopBuyItem : public CTAsyncCmd
{
public:
    virtual int Do(void* pData);
    int PreCheck     (CPlayerBaseInfo &, CPlayerDetailInfo &, CPlayerOnlineData & );
    int AfterBuyItem (CPlayerBaseInfo &, CPlayerDetailInfo &, CPlayerOnlineData & );
    virtual int AnsClients(int iRet);
    virtual int LogicDo(int iRet);

    CMainCtrl* pstMainCtrl;
    PBMsgHead  stMsgHead;
    CEnpNetHead stEnpHead;

    MsgReqBuyItem stReq;
    MsgAnsBuyItem stAns;
    CShopItemConfig stShopConfigData;
    unsigned int _uiGID;
    unsigned int _uiNotify;
};

class CCmdShopSellItem : public CTAsyncCmd
{
public:
    virtual int Do(void* pData);
    virtual int AnsClients(int iRet);
    virtual int LogicDo(int iRet);

    int GetSoldItem (CStorageGrid &stGrid, CShopBuyBackItem & stSoldItem);

    CMainCtrl* pstMainCtrl;
    PBMsgHead  stMsgHead;
    CEnpNetHead stEnpHead;

    MsgReqSellItem stReq;
    MsgAnsSellItem stAns;
    unsigned int _uiGID;
};

class CCmdShopRefreshItem : public CTAsyncCmd
{
public:
    virtual int Do(void* pData);
    virtual int AnsClients(int iRet);
    virtual int LogicDo(int iRet);

    CMainCtrl* pstMainCtrl;
    PBMsgHead  stMsgHead;
    CEnpNetHead stEnpHead;

    MsgReqRefreshItem stReq;
    unsigned int _uiGID;
};

#endif // __cmdshop_h__

